import { MidwayConfig } from '@midwayjs/core';
import { busboyConfig } from "@config/busboy.config";

export default {
  // use for cookie sign key, should change to your own and keep security
  keys: 'ruoyi-nodejs-open-2024-secret-key',
  koa: {
    port: 7002,
  },
  validate: {
    enable: true,
    validationOptions: {
      allowUnknown: true, // 允许未定义的字段
      abortEarly: true,
      stripUnknown: true, // 剔除参数中的未定义属性
    }
  },
  jwt: {
    secret: 'ruoyi-jwt-secret-key-2024',
    expiresIn: '2d', // 2天过期
  },

  // 文件上传配置
  busboy: busboyConfig,

  redis: {
    client: {
      host: 'localhost',
      port: 6379,
      password: '',
      db: 0
    }
  },

  typeorm: {
    dataSource: {
      default: {
        type: 'mysql',
        host: '127.0.0.1',        // 数据库主机
        port: 3306,               // 数据库端口
        username: 'root',         // 数据库用户名
        password: '123456',       // 数据库密码（请修改为你的实际密码）
        database: 'ruoyi_nodejs_open',  // 数据库名
        synchronize: false,       // 生产环境建议设为false
        logging: false,
        entities: ['entity'],
        timezone: '+08:00',
        dateStrings: true,
        bigNumberStrings: false,
      }
    }
  }
} as MidwayConfig;
